<div class="problemindexholder" problemindex="B">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     B. Makes And The Product
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     2 seconds
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     256 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     After returning from the army Makes received a gift — an array
     <span class="tex-span">
      <i>
       a
      </i>
     </span>
     consisting of
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     positive integer numbers. He hadn't been solving problems for a long time, so he became interested to answer a particular question: how many triples of indices
     <span class="tex-span">
      (
      <i>
       i
      </i>
      ,
      <i>
       j
      </i>
      ,
      <i>
       k
      </i>
      )
     </span>
     (
     <span class="tex-span">
      <i>
       i
      </i>
      &lt;
      <i>
       j
      </i>
      &lt;
      <i>
       k
      </i>
     </span>
     ), such that
     <span class="tex-span">
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ·
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        j
       </i>
      </sub>
      ·
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        k
       </i>
      </sub>
     </span>
     is minimum possible, are there in the array? Help him with it!
    </p>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     The first line of input contains a positive integer number
     <span class="tex-span">
      <i>
       n
      </i>
      (3 ≤
      <i>
       n
      </i>
      ≤ 10
      <sup class="upper-index">
       5
      </sup>
      )
     </span>
     — the number of elements in array
     <span class="tex-span">
      <i>
       a
      </i>
     </span>
     . The second line contains
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     positive integer numbers
     <span class="tex-span">
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      (1 ≤
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ≤ 10
      <sup class="upper-index">
       9
      </sup>
      )
     </span>
     — the elements of a given array.
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     Print one number — the quantity of triples
     <span class="tex-span">
      (
      <i>
       i
      </i>
      ,
      <i>
       j
      </i>
      ,
      <i>
       k
      </i>
      )
     </span>
     such that
     <span class="tex-span">
      <i>
       i
      </i>
      ,
      <i>
       j
      </i>
     </span>
     and
     <span class="tex-span">
      <i>
       k
      </i>
     </span>
     are pairwise distinct and
     <span class="tex-span">
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ·
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        j
       </i>
      </sub>
      ·
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        k
       </i>
      </sub>
     </span>
     is minimum possible.
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>4<br/>1 1 1 1<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>4<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>5<br/>1 3 2 3 4<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>2<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>6<br/>1 3 3 1 3 2<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>1<br/></pre>
     </div>
    </div>
   </div>
   <div class="note">
    <div class="section-title">
     Note
    </div>
    <p>
     In the first example Makes always chooses three ones out of four, and the number of ways to choose them is
     <span class="tex-span">
      4
     </span>
     .
    </p>
    <p>
     In the second example a triple of numbers
     <span class="tex-span">
      (1, 2, 3)
     </span>
     is chosen (numbers, not indices). Since there are two ways to choose an element
     <span class="tex-span">
      3
     </span>
     , then the answer is
     <span class="tex-span">
      2
     </span>
     .
    </p>
    <p>
     In the third example a triple of numbers
     <span class="tex-span">
      (1, 1, 2)
     </span>
     is chosen, and there's only one way to choose indices.
    </p>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
